﻿
using System;
using System.ServiceModel;
using System.Runtime.Serialization;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace EnterpriseServices.Service
{
    public partial class UserProxy 
    {

        #region IUserManager Members

        /// <summary>
        /// Authenticates the specified application name.
        /// </summary>
        /// <param name="applicationName">Name of the application.</param>
        /// <param name="userName">Name of the user.</param>
        /// <param name="password">The password.</param>
        /// <returns></returns>
        public bool Authenticate(string applicationName, string userName, string password)
        {
            IUserManager proxy = new ChannelFactory<IUserManager>().CreateChannel();
            return proxy.Authenticate(applicationName, userName, password);
        }

        /// <summary>
        /// Determines whether [is in role] [the specified application name].
        /// </summary>
        /// <param name="applicationName">Name of the application.</param>
        /// <param name="userName">Name of the user.</param>
        /// <param name="role">The role.</param>
        /// <returns>
        /// 	<c>true</c> if [is in role] [the specified application name]; otherwise, <c>false</c>.
        /// </returns>
        public bool IsInRole(string applicationName, string userName, string role)
        {
            IUserManager proxy = new ChannelFactory<IUserManager>().CreateChannel();
            return proxy.IsInRole(applicationName, userName, role);
        }

        /// <summary>
        /// Gets the roles.
        /// </summary>
        /// <param name="applicationName">Name of the application.</param>
        /// <param name="userName">Name of the user.</param>
        /// <returns></returns>
        public string[] GetRoles(string applicationName, string userName)
        {
            IUserManager proxy = new ChannelFactory<IUserManager>().CreateChannel();
            return proxy.GetRoles(applicationName, userName) ;
        }

        #endregion
    }
}
